﻿
			function getFormPanel(){
				return new Ext.form.FormPanel({
					frame:true,
					region:'center',   
          split:true,   
          width:200,
					id:'PanelForm',
					bodyStyle:'padding:5px 5px 0',
					url:'modifyOrg.action',
					items: [{   
            layout:'column',   
            items:[{   
                columnWidth:1,   
                layout: 'form',
                items: [{
                    xtype:'label',  
                    height:15
                },{
                		xtype:'hidden',  
                    id:'operation',
                    name:'operation'
                    
                	},{
                		xtype:'hidden',  
                    id:'org_id',
                    name:'org_id'
                	},{
                		xtype:'hidden',  
                    id:'parentorg_id',
                    name:'parentorg_id'
                	}]   
            },{   
                columnWidth:1,   
                layout: 'form', 
                height:25,  
                items: [{
                    xtype:'label',  
                    id:'parent_name',
                    name:'parent_name',
                    anchor:'95%'
                }]   
            },
            {   
                columnWidth:.5,   
                layout: 'form',   
                items: [{   
                    xtype:'textfield',   
                    id:'org_code',
                    name: 'org_code',
                    fieldLabel: '组织机构编码',
                    allowBlank:false,
										emptyText:'请输入组织机构编码',
										blankText:'组织机构编码不能为空',  
                    anchor:'95%'  
                }]   
            },{   
                columnWidth:.5,   
                layout: 'form',   
                items: [{   
                    xtype:'textfield', 
                    id:'org_name',
                    name: 'org_name',
                    fieldLabel: '组织机构名称', 
                    allowBlank:false,
										emptyText:'请输入组织机构名称',
										blankText:'组织机构名称不能为空',  
                    anchor:'95%'  
                }]   
            }]   
        },{  
                layout: 'form', 
                labelAlign:'top',  
                items: [{
                    xtype:'textarea',  
                    id:'org_memo',
                    name:'org_memo', 
                    fieldLabel: '说明',
                    allowBlank:true,  
                    anchor:'95%'  
                }]  
              
        }],
					buttons: [{   
            text: '确定' ,
            id : 'commit',
            handler: function() {
							//校验表单合法性
							if (!this.findParentByType('form').findById('org_code').validate()){
								this.findParentByType('form').findById('org_code').focus();
								return;
							}
							if (!this.findParentByType('form').findById('org_name').validate()){
								this.findParentByType('form').findById('org_name').focus();
								return;
							}
							this.findParentByType('form').getForm().submit();
							this.findParentByType('window').hide();
						}
           },{   
            text: '取消',
            id : 'cancel',
            handler: function() {
            		this.findParentByType('window').hide();
            	}
        	}]
				});
				
			}
			
			function getWindow(){
				var formPanel = getFormPanel();
				return new Ext.Window({
			    	buttonalign:'right',
						region:'center',
						plain:true,
						draggable:true,  
						closable:true,   
						width:500,   
						height:250,
						modal:true,
						resizable:false,
						border:false,  
						frame:true, 
						plain:true,   
						layout: 'border',
						items: [formPanel],
						listeners : {"beforedestroy" : function(obj) {
							obj.hide();
							return false;
						},"beforeshow":function(obj) {
							return true;
						},"beforehide":function(obj) {
							return true;
						}
					}
					});
				}		